<%@page contentType="text/html;charset=utf-8" pageEncoding="UTF-8" %>
<%@page import="org.ipo.mm.web.util.ConstantManager,
java.util.Collection, org.ipo.mm.web.util.security.SecurityManager,
org.ipo.mm.ejb.entities.Meeting,org.ipo.mm.ejb.entities.Representative" %>
<%@taglib prefix="h" uri="http://struts.apache.org/tags-html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="l" uri="http://struts.apache.org/tags-logic" %>
<%@ taglib prefix="b" uri="http://struts.apache.org/tags-bean" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>



<%--
   prenosim naziv i vrednost parametra 'method' da bi se moglo
prikazati submit dugme koje se gubi pri vaidaciji :)

--%>


<h1><%=request.getSession().getAttribute("title")%></h1>
<script type="text/javascript">
  function openInNewWindow() {
       window.open(arguments[0],'Test',"menubar=yes,width=923,height=400,toolbar=no");
   }
   function start(){
       switchMenu('file2');
       switchMenu('file3');
       switchMenu('file4');
       switchMenu('file5');
       switchMenu('file6');
       switchMenu('file7');
       switchMenu('file8');
       switchMenu('file9');
       switchMenu('file10');
       switchMenu('file11');
       switchMenu('file12');
       switchMenu('file13');
       switchMenu('file14');
       switchMenu('file15');
       switchMenu('file16');
       switchMenu('file17');
       switchMenu('file18');
       switchMenu('file19');
       switchMenu('file20');
       switchMenu('file21');
       switchMenu('file22');
       switchMenu('file23');
       switchMenu('file24');
       switchMenu('file25');
       switchMenu('file26');
       switchMenu('file27');
       switchMenu('file28');
       switchMenu('file29');
       switchMenu('file30');

       switchMenu('allResults');
   }
   
</script>
<div id="meetingFormDiv">


   <h:form action="/protected/meeting?&method=${param['method']}&rf=false"
enctype="multipart/form-data" styleId="meetingForm">

<div id="meetingTabs">
       <ul>
		<li><a href="#generalInformation"><b:message key="meetings_meeting_info"/></a></li>
		<li><a href="#people"><b:message key="meetings_participants"/></a></li>
		<li><a href="#meetingData"> <b:message key="meetings_meeting_data"/> </a></li>
		<li><a href="#actions"> <b:message key="meetings_actions"/></a></li>
		<li><a href="#note"> <b:message key="gen_note"/></a></li>
		<li><a href="#files"><b:message key="meetings_files"/> </a></li>
		<!--<li><a href="#actions"><b:message key="meetings_actions"/></a></li>-->
		<!--
		<li><a href="#organizer"><b:message key="meetings_organizer"/></a></li>
		<li><a href="#participants"><b:message key="meetings_participants"/></a></li>
		-->
</ul>



<%Collection<Integer> privileges = (Collection<Integer>)request.getSession().getAttribute(ConstantManager.SESSION_USER_PRIVILEGES);%>







<div id="generalInformation">
	   <fieldset>
               <legend><b:message key="meetings_meeting_info"/></legend>
                   <label for='<b:message key="meetings_event_name"/>'><b:message key="meetings_event_name"/></label>
				   <h:text property="eventName" size="100" maxlength="512" styleClass="required"/><br/><br/>
				   <label for='<b:message key="meetings_date"/>'><b:message key="meetings_date"/>(dd/mm/yyyy)</label>
				   <h:text styleId="date" property="date" styleClass="required date"/>
				   <button type="button" class="button" id="dateButton">...</button>
                       <script type="text/javascript">//<![CDATA[
                           var cal = Calendar.setup({
                               onSelect: function(cal) { cal.hide() },
                               selectionType : Calendar.SEL_SINGLE
                           });
                           //cal.manageFields("dateButton", "date","%d/%m/%Y %H:%M");
                           cal.manageFields("dateButton", "date", "%d/%m/%Y");
                           //]]>
						   </script>
                       <label for='<b:message key="meetings_date_start_time"/>'><b:message key="meetings_date_start_time"/></label>
                       <h:select property="startTime">
                           <h:option value="00:00">00:00</h:option>
                           <h:option value="00:30">00:30</h:option>
                           <h:option value="01:00">01:00</h:option>
                           <h:option value="01:30">01:30</h:option>
                           <h:option value="02:00">02:00</h:option>
                           <h:option value="02:30">02:30</h:option>
                           <h:option value="03:00">03:00</h:option>
                           <h:option value="03:30">03:30</h:option>
                           <h:option value="04:00">04:00</h:option>
                           <h:option value="04:30">04:30</h:option>
                           <h:option value="05:00">05:00</h:option>
                           <h:option value="05:30">05:30</h:option>
                           <h:option value="06:00">06:00</h:option>
                           <h:option value="06:30">06:30</h:option>
                           <h:option value="07:00">07:00</h:option>
                           <h:option value="07:30">07:30</h:option>
                           <h:option value="08:00">08:00</h:option>
                           <h:option value="08:30">08:30</h:option>
                           <h:option value="09:00">09:00</h:option>
                           <h:option value="09:30">09:30</h:option>
                           <h:option value="10:00">10:00</h:option>
                           <h:option value="10:30">10:30</h:option>
                           <h:option value="11:00">11:00</h:option>
                           <h:option value="11:30">11:30</h:option>
                           <h:option value="12:00">12:00</h:option>
                           <h:option value="12:30">12:30</h:option>
                           <h:option value="13:00">13:00</h:option>
                           <h:option value="13:30">13:30</h:option>
                           <h:option value="14:00">14:00</h:option>
                           <h:option value="14:30">14:30</h:option>
                           <h:option value="15:00">15:00</h:option>
                           <h:option value="15:30">15:30</h:option>
                           <h:option value="16:00">16:00</h:option>
                           <h:option value="16:30">16:30</h:option>
                           <h:option value="17:00">17:00</h:option>
                           <h:option value="17:30">17:30</h:option>
                           <h:option value="18:00">18:00</h:option>
                           <h:option value="18:30">18:30</h:option>
                           <h:option value="19:00">19:00</h:option>
                           <h:option value="19:30">19:30</h:option>
                           <h:option value="20:00">20:00</h:option>
                           <h:option value="20:30">20:30</h:option>
                           <h:option value="21:00">21:00</h:option>
                           <h:option value="21:30">21:30</h:option>
                           <h:option value="22:00">22:00</h:option>
                           <h:option value="22:30">22:30</h:option>
                           <h:option value="23:00">23:00</h:option>
                           <h:option value="23:30">23:30</h:option>
                       </h:select>
                       <label for='<b:message key="meetings_date_end_time"/>'><b:message key="meetings_date_end_time"/></label>
                       <h:select property="endTime"><br/><br/>
                           <h:option value="00:00">00:00</h:option>
                           <h:option value="00:30">00:30</h:option>
                           <h:option value="01:00">01:00</h:option>
                           <h:option value="01:30">01:30</h:option>
                           <h:option value="02:00">02:00</h:option>
                           <h:option value="02:30">02:30</h:option>
                           <h:option value="03:00">03:00</h:option>
                           <h:option value="03:30">03:30</h:option>
                           <h:option value="04:00">04:00</h:option>
                           <h:option value="04:30">04:30</h:option>
                           <h:option value="05:00">05:00</h:option>
                           <h:option value="05:30">05:30</h:option>
                           <h:option value="06:00">06:00</h:option>
                           <h:option value="06:30">06:30</h:option>
                           <h:option value="07:00">07:00</h:option>
                           <h:option value="07:30">07:30</h:option>
                           <h:option value="08:00">08:00</h:option>
                           <h:option value="08:30">08:30</h:option>
                           <h:option value="09:00">09:00</h:option>
                           <h:option value="09:30">09:30</h:option>
                           <h:option value="10:00">10:00</h:option>
                           <h:option value="10:30">10:30</h:option>
                           <h:option value="11:00">11:00</h:option>
                           <h:option value="11:30">11:30</h:option>
                           <h:option value="12:00">12:00</h:option>
                           <h:option value="12:30">12:30</h:option>
                           <h:option value="13:00">13:00</h:option>
                           <h:option value="13:30">13:30</h:option>
                           <h:option value="14:00">14:00</h:option>
                           <h:option value="14:30">14:30</h:option>
                           <h:option value="15:00">15:00</h:option>
                           <h:option value="15:30">15:30</h:option>
                           <h:option value="16:00">16:00</h:option>
                           <h:option value="16:30">16:30</h:option>
                           <h:option value="17:00">17:00</h:option>
                           <h:option value="17:30">17:30</h:option>
                           <h:option value="18:00">18:00</h:option>
                           <h:option value="18:30">18:30</h:option>
                           <h:option value="19:00">19:00</h:option>
                           <h:option value="19:30">19:30</h:option>
                           <h:option value="20:00">20:00</h:option>
                           <h:option value="20:30">20:30</h:option>
                           <h:option value="21:00">21:00</h:option>
                           <h:option value="21:30">21:30</h:option>
                           <h:option value="22:00">22:00</h:option>
                           <h:option value="22:30">22:30</h:option>
                           <h:option value="23:00">23:00</h:option>
                           <h:option value="23:30">23:30</h:option>
                       </h:select>
                       <span class="error" ><h:errors property="date" /></span><br/><br/>
<label for='<b:message key="meetings_venue"/>'><b:message key="meetings_venue"/></label>
<h:text property="venue" size="100" maxlength="512"/>
</fieldset>
</div>


<div id="people">
               <fieldset>
			   <legend><b:message key="meetings_people"/></legend>
			   <fieldset>
			   <legend><b:message key="meetings_organizer"/></legend>
                       <c:choose>
                           <c:when test="${not empty MEETING_PROCESS.organizer}">
					
                               ${MEETING_PROCESS.organizer.lastName}
							   ${MEETING_PROCESS.organizer.firstName}
                               ${MEETING_PROCESS.organizer.institution.name}
                           </c:when>
                           <c:otherwise>
                               <b:message key="meetings_not_selected"/>
                           </c:otherwise>
                       </c:choose>
                       <span class="error" ><h:errors property="organizer" /></span>
                     </fieldset>
					 <br/>
 <fieldset>
<legend><b:message key="meetings_participants"/></legend>
					   
                       <%-- if there are no particiapnts label is renderd --%>
                       <% if (((Meeting) request.getSession().getAttribute(ConstantManager.SESSION_MEETING_PROCESS_AN)).getRepresentativeCollection().isEmpty()){%>
                       <b:message key="meetings_not_selected"/>
                       <%}%>
                       <!-- dugme za ukljanjanje predstavnika iz liste sastanak se prikazuje samo ako lista ima elemenata -->
                       <% Collection representatives = ((Meeting)
request.getSession().getAttribute(ConstantManager.SESSION_MEETING_PROCESS_AN)).getRepresentativeCollection();
           if (representatives.size() > 0) {%>
					   
<table id="tableParticipants" class="display">
<thead>
<tr>
<th><b:message key="meetings_add_repr"/></th>
<th><b:message key="repr_firstName"/></th>
<th><b:message key="repr_lastName"/></th>
<th><b:message key="repr_inst"/></th>
</tr>
</thead>
<tbody>
 <l:iterate id="repr" name="MEETING_PROCESS" property="representativeCollection">
<tr>
	<td>
	<input type='checkbox' value='<b:write name="repr" property="id"/>' name='selectedReprForRemove'>
	</td>
    <td><b:write name="repr" property="firstName"/></td>
    <td><b:write name="repr" property="lastName"/></td>
    <td>${repr.institution.name}</td>        
</tr>
</l:iterate>
</tbody>
</table>
<h:submit property="operation" styleClass="button"><b:message key="meetings_remove_repr" /></h:submit>
<%}%>
</fieldset><br/>
<!--<a href="#" onclick="alert('a');post1();postForm();alert('b');">posalji</a>-->
<fieldset id="searchParticipants" class="hideInViewDialog">
<legend><b:message key="meetings_search_participants"/></legend>
<!--<h:text property="searchQuery" /> 
<h:submit property="operation" styleId="findRep">
<b:message key="meetings_search_repr"/>
</h:submit>-->
<br>
<l:notEmpty name="MeetingBean" property="reprSearchResults">
<b:message key="meetings_search_participants_results"/>:
</l:notEmpty>

<div id="searchRepDiv">
<table id="searchRepTable" class="display">
<thead>
<tr>
<th><b:message key="meetings_add_repr"/></th>
<th><b:message key="repr_firstName"/></th>
<th><b:message key="repr_lastName"/></th>
<th><b:message key="repr_inst"/></th>
</tr>
</thead>
  <tfoot>
		<tr>
			<th><input type="text" name="" value="" class="search_init" /></th>
			<th><input type="text" name=""  value="" class="search_init" /></th>
			<th><input type="text" name="" value="" class="search_init" /></th>
			<th><input type="text" name="" value="" class="search_init" /></th>
		</tr>
		</tfoot>
<tbody>
<l:iterate id="sresult" name="MeetingBean" property="reprSearchResults" indexId="i">
<tr>
<td>
<h:multibox property="selectedRepresentatives">
<b:write name="sresult" property="id"/>
</h:multibox>
</td>
<td><b:write name="sresult" property="lastName" /></td>
<td><b:write name="sresult" property="firstName" /></td>
<td>${sresult.institution.name}</td>
</tr>
</l:iterate>
</tbody>
</table>
</div>

<b:message key="meetings_participants_select_role"/><br/>
<l:notEmpty name="MeetingBean" property="reprSearchResults">
<h:radio property="role" value="Representative" /> 
<b:message key="meetings_participant_role"/>
<br>
<h:radio property="role" value="Organizer"/> 
<b:message key="meetings_organizer_role"/>
<br>
<h:submit property="operation" styleClass="button">
<b:message key="meetings_add_repr" />
</h:submit>
</l:notEmpty>
<h:submit property="operation" styleClass="button hidden">
<b:message key="repr_create"/>
</h:submit>

</fieldset>
</fieldset>
</div>

<div id="meetingData">
<fieldset>
<legend><b:message key="meetings_meeting_data"/></legend>
<label for="meetingMinutes"><b:message key="meetings_minutes"/></label><br/>
<h:textarea cols="100" rows="20" property="conclusion" style="background-color: #DDDDDD" styleId="display"/>
</fieldset>
</div>


<div id="actions">
<fieldset>
<legend><b:message key="meetings_actions"/></legend>
<script type="text/javascript">//<![CDATA[
                           var cal = Calendar.setup({
                               onSelect: function(cal) { cal.hide() }
                           });
                           cal.manageFields("actionDateButton","actionDate", "%d/%m/%Y");
                           //]]></script>
<script type="text/javascript">
function dodajAkciju(){
if(!document.getElementById("actionName").value == "" &&
!document.getElementById("actionAction").value == ""){
document.getElementById("actions").value =
document.getElementById("actions").value  +
document.getElementById("actionName").value+"|"+
document.getElementById("actionAction").value+"|"+
document.getElementById("actionDate").value+ "\n";
document.getElementById("actionName").value = "";
document.getElementById("actionAction").value = "";
document.getElementById("actionDate").value = "";
                               }
                           }
</script>
<br/>
<div>
<a name="actionAnchor"></a>
<table border="1">
<tr>
<th><b:message key="meetings_action_action"/></th>
<th><b:message key="meetings_action_name"/></th>
<th><b:message key="meetings_action_status"/></th>
<th><b:message key="meetings_action_due_date"/></th>
<th></th>
</tr>
<l:iterate id="meetingActions" name="MEETING_PROCESS" property="meetingActions">
<tr style="border-bottom-width: thin;border-bottom-style: solid;border-bottom-color: #000000;">
<td><b:write name="meetingActions" property="actionText"/></td>
<td><b:write name="meetingActions" property="name"/></td>
<td>
<c:choose>
<c:when test="${meetingActions.status == 'FINISHED'}">
<b:message key="actions_finished" />
</c:when>
<c:when test="${meetingActions.status == 'PENDING'}">
<b:message key="actions_pending" />
</c:when>
</c:choose>
</td>
<td><b:write name="meetingActions" property="dueDate" format="dd/MM/yyyy"/></td>
<td>								   
<c:if test="${not empty meetingActions.id}">
<%if (privileges.contains(SecurityManager.EDIT_ACTIONS_PRIVILEGE)) {%>
<!--
<a href="javascript:openInNewWindow('dispatch.do?method=showUpdateActionsForm&aid=${meetingActions.id}');">
<b:message key="gen_update"/>
</a>
-->
<p class="updateAction hideInViewDialog" id="${meetingActions.id}" onclick="loadHtml('<%= request.getContextPath()%>/protected/dispatch.do?method=showUpdateActionsForm&aid=${meetingActions.id}','#updateAction${meetingActions.id}','#actionForm',callback);">
<b:message key="gen_update"/></p>
<%}%>
<%if(privileges.contains(SecurityManager.DELETE_ACTIONS_PRIVILEGE)) {%>
<h:link styleClass="hideInViewDialog" action="/protected/dispatch?method=deleteActions&aid=${meetingActions.id}">
<b:message key="gen_delete"/>
</h:link>
<!--<p class="deleteAction" id="${meetingActions.id}"><b:message key="gen_delete"/></p>-->
<%}%>
</c:if>
</td>
</tr>
<tr>
<td colspan="5">
<div id="updateAction${meetingActions.id}" class="updateActionDiv"></div></td>
</tr>
</l:iterate>  
</table>
</div>
<!--<a href="javascript:openInNewWindow('dispatch.do?method=showCreateActionsForm');" class="hideInViewDialog">
<b:message key="meetings_action_add"/></a>-->
<!-- actions end -->
<div id="newAction"></div>
<div id="messageregion"></div>
<p id="addAction" class="hideInViewDialog link"><b:message key="meetings_action_add"/></p>

</fieldset>
</div>

<div id="note">
<fieldset>
<legend><b:message key="gen_note"/></legend>
<h:textarea cols="100" rows="10" property="note"/>
</fieldset>
</div>

<div id="files">
<fieldset>
<legend><b:message key="meetings_files"/></legend>
<c:if test="${param['method'] == 'showUpdateMeetingForm'}">
<b:message key="meetings_files"/>
<l:iterate id="doc" name="MEETING_PROCESS"
property="documentCollection">

<h:multibox property="selectedDocuments">
${doc.id}
</h:multibox>

${doc.fileName} ${doc.name}
${doc.note}
<a href="doc_download?did=${doc.id}&mid=${doc.meeting.id}"  class="download">Download</a>
<br/>
</l:iterate>
<br>
<l:notEmpty name="MEETING_PROCESS" property="documentCollection">
<h:submit property="operation" styleClass="button"><b:message key="meetings_remove_doc"/>
</h:submit>
</l:notEmpty>
<l:empty name="MEETING_PROCESS" property="documentCollection">
<b:message key="meetings_no_docs"/>
</l:empty>
</c:if>
<div class="hideInViewDialog">
<b:message key="meetings_files_adding_title"/>
<div id="file1"><p><b:message key="meetings_files_name"/> <h:text property="doc1Name"/> <b:message key="meetings_files_note"/>
<h:text property="doc1Note"/><h:file property="doc1file" styleClass="button"/>
<input class="button" name="addFile2" value="<b:message key="meetings_files_add"/>"onclick="switchMenu('file2');this.disabled=true;"
type="button"></p>
</div>
<div id="file2"><p><b:message key="meetings_files_name"/> <h:text property="doc2Name"/><b:message key="meetings_files_note"/>
<h:text property="doc2Note"/><h:file property="doc2file" />
<input name="addFile3" class="button" value="<b:message key="meetings_files_add"/>"onclick="switchMenu('file3');this.disabled=true;"
type="button"></p>
</div>
<div id="file3"><p><b:message key="meetings_files_name"/> <h:text property="doc3Name"/>
	<b:message key="meetings_files_note"/><h:text property="doc3Note"/> <h:file property="doc3file" />
    <input name="addFile4" value="<b:message key='meetings_files_add'/>" onclick="switchMenu('file4');this.disabled=true;" type="button">
</p></div>
                        <div id="file4"><p><b:message key="meetings_files_name"/> <h:text property="doc4Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc4Note"/>
                                <h:file property="doc4file" />
                                <input name="addFile5" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file5');this.disabled=true;" type="button"></p>
								</div>
                        <div id="file5"><p><b:message key="meetings_files_name"/> <h:text property="doc5Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc5Note"/>
                                <h:file property="doc5file" />
                                <input name="addFile6" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file6');this.disabled=true;" type="button"></p>
								</div>
                        <div id="file6"><p><b:message key="meetings_files_name"/> <h:text property="doc6Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc6Note"/>
                                <h:file property="doc6file" />
                                <input name="addFile7" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file7');this.disabled=true;" type="button"></p></div>
                        <div id="file7"><p><b:message key="meetings_files_name"/> <h:text property="doc7Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc7Note"/>
                                <h:file property="doc7file" />
                                <input name="addFile8" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file8');this.disabled=true;" type="button"></p></div>
                        <div id="file8"><p><b:message key="meetings_files_name"/> <h:text property="doc8Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc8Note"/>
                                <h:file property="doc8file" />
                                <input name="addFile9" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file9');this.disabled=true;" type="button"></p></div>
                        <div id="file9"><p><b:message key="meetings_files_name"/> <h:text property="doc9Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc9Note"/>
                                <h:file property="doc9file" />
                                <input name="addFile10" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file10');this.disabled=true;" type="button"></p></div>
                        <div id="file10"><p><b:message key="meetings_files_name"/> <h:text property="doc10Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc10Note"/>
                                <h:file property="doc10file" />
                                <input name="addFile11" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file11');this.disabled=true;" type="button"></p></div>
                        <div id="file11"><p><b:message key="meetings_files_name"/> <h:text property="doc11Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc11Note"/>
                                <h:file property="doc11file" />
                                <input name="addFile12" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file12');this.disabled=true;" type="button"></p></div>
                        <div id="file12"><p><b:message key="meetings_files_name"/> <h:text property="doc12Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc12Note"/>
                                <h:file property="doc12file" />
                                <input name="addFile13" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file13');this.disabled=true;" type="button"></p></div>
                        <div id="file13"><p><b:message key="meetings_files_name"/> <h:text property="doc13Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc13Note"/>
                                <h:file property="doc13file" />
                                <input name="addFile14" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file14');this.disabled=true;" type="button"></p></div>
                        <div id="file14"><p><b:message key="meetings_files_name"/> <h:text property="doc14Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc14Note"/>
                                <h:file property="doc14file" />
                                <input name="addFile15" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file15');this.disabled=true;" type="button"></p></div>
                        <div id="file15"><p><b:message key="meetings_files_name"/> <h:text property="doc15Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc15Note"/>
                                <h:file property="doc15file" />
                                <input name="addFile16" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file16');this.disabled=true;" type="button"></p></div>
                        <div id="file16"><p><b:message key="meetings_files_name"/> <h:text property="doc16Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc16Note"/>
                                <h:file property="doc16file" />
                                <input name="addFile17" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file17');this.disabled=true;" type="button"></p></div>
                        <div id="file17"><p><b:message key="meetings_files_name"/> <h:text property="doc17Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc17Note"/>
                                <h:file property="doc17file" />
                                <input name="addFile18" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file18');this.disabled=true;" type="button"></p></div>
                        <div id="file18"><p><b:message key="meetings_files_name"/> <h:text property="doc18Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc18Note"/>
                                <h:file property="doc18file" />
                                <input name="addFile19" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file19');this.disabled=true;" type="button"></p></div>
                        <div id="file19"><p><b:message key="meetings_files_name"/> <h:text property="doc19Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc19Note"/>
                                <h:file property="doc19file" />
                                <input name="addFile20" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file20');this.disabled=true;" type="button"></p></div>
                        <div id="file20"><p><b:message key="meetings_files_name"/> <h:text property="doc20Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc20Note"/>
                                <h:file property="doc20file" />
                                <input name="addFile21" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file21');this.disabled=true;" type="button"></p></div>
                        <div id="file21"><p><b:message key="meetings_files_name"/> <h:text property="doc21Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc21Note"/>
                                <h:file property="doc21file" />
                                <input name="addFile22" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file22');this.disabled=true;" type="button"></p></div>
                        <div id="file22"><p><b:message key="meetings_files_name"/> <h:text property="doc22Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc22Note"/>
                                <h:file property="doc22file" />
                                <input name="addFile23" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file23');this.disabled=true;" type="button"></p></div>
                        <div id="file23"><p><b:message key="meetings_files_name"/> <h:text property="doc23Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc23Note"/>
                                <h:file property="doc23file" />
                                <input name="addFile24" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file24');this.disabled=true;" type="button"></p></div>
                        <div id="file24"><p><b:message key="meetings_files_name"/> <h:text property="doc24Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc24Note"/>
                                <h:file property="doc24file" />
                                <input name="addFile25" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file25');this.disabled=true;" type="button"></p></div>
                        <div id="file25"><p><b:message key="meetings_files_name"/> <h:text property="doc25Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc25Note"/>
                                <h:file property="doc25file" />
                                <input name="addFile26" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file26');this.disabled=true;" type="button"></p></div>
                        <div id="file26"><p><b:message key="meetings_files_name"/> <h:text property="doc26Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc26Note"/>
                                <h:file property="doc26file" />
                                <input name="addFile27" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file27');this.disabled=true;" type="button"></p></div>
                        <div id="file27"><p><b:message key="meetings_files_name"/> <h:text property="doc27Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc27Note"/>
                                <h:file property="doc27file" />
                                <input name="addFile28" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file28');this.disabled=true;" type="button"></p></div>
                        <div id="file28"><p><b:message key="meetings_files_name"/> <h:text property="doc28Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc28Note"/>
                                <h:file property="doc28file" />
                                <input name="addFile29" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file29');this.disabled=true;" type="button"></p></div>
                        <div id="file29"><p><b:message key="meetings_files_name"/> <h:text property="doc29Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc29Note"/>
                                <h:file property="doc29file" />
                                <input name="addFile30" value="<b:message key="meetings_files_add"/>" onclick="switchMenu('file30');this.disabled=true;" type="button"></p></div>
                        <div id="file30"><p><b:message key="meetings_files_name"/> <h:text property="doc30Name"/>
                                <b:message key="meetings_files_note"/> <h:text property="doc30Note"/>
                                <h:file property="doc30file" /></p></div>
								</div>

</fieldset>
</div>

<fieldset> 
<script type="text/javascript">

           function checkDraft(){
               if(!document.MeetingBean.draft[0].checked){
                   return confirm('Save meeting to database permanently?/Da li zelis da snimis sastanak u bazu? Vise neces moci da ga menjas!');
               }
               return true;
           }

       </script>

       <h:checkbox property="draft"><span class="important">
	   <b:message key="meetings_draft"/></span>
	   </h:checkbox>
       <!-- if user has a privilage to CREATE meetings -->
       <%if (privileges.contains(SecurityManager.CREATE_MEETING_PRIVILEGE)){%>
       <c:if test="${param['method'] == 'showCreateMeetingForm'}">
           <h:submit property="operation" styleClass="button"><b:message key="gen_create"/></h:submit>
       </c:if>
       <%}%>
       <!-- if user has a privilage to EDIT meetings -->
       <%if (privileges.contains(SecurityManager.EDIT_MEETING_PRIVILEGE)) {%>
       <!-- if user is owner of meeting entiry -->
       <c:if test="${(param['method'] == 'showUpdateMeetingForm')}">
               <h:submit property="operation" styleClass="button">
			   <b:message key="gen_update"/>
			   </h:submit>
       </c:if>
       <%}%>
       <!--<h:cancel styleClass="button" onclick="$('#meetingDialog').dialog('close');return false;"><b:message key="gen_cancel"/></h:cancel>-->
    	<input type="reset" value="<b:message key="gen_cancel"/>" onclick="cancelForm();"/>

</fieldset><br/>


</h:form>


<script type="text/javascript">
   $('#addAction').click(function (){
       $('#messageregion').html('');
       $('#newAction').html('');
		//getHtmlAjax('<%= request.getContextPath()%>/protected/dispatch.do?method=showCreateActionsForm','#newAction','#actionForm');
		$.get('<%= request.getContextPath()%>/protected/dispatch.do?method=showCreateActionsForm',
   function(data){
     //alert("Data Loaded: " + data);
	 var forma =$(data).find('#actionInput').html();
	 //alert(forma);
	 $('#newAction').html(forma);
   });
     
   });
   
 </script>
</div>
</div>
<script type="text/javascript">
function cancelForm(){
		history.go(-1);
}
</script>
